package com.demo.utils;

import java.io.IOException;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.demo.exception.MybatisMapperException;

public class CustomSqlSessionFactoryBean extends SqlSessionFactoryBean {

	private Logger logger = LoggerFactory.getLogger(CustomSqlSessionFactoryBean.class);

	@Override
	protected SqlSessionFactory buildSqlSessionFactory() throws IOException {
		try {
			return super.buildSqlSessionFactory();
		} catch (Exception e) {
			logger.error("mybatis mapper file error: " + e.getMessage());

			throw new MybatisMapperException("mybatis mapper file error !");
		}
	}
}
